<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../print.css" type="text/css" media="print">
<meta content="b2Shape,Box2D.Collision.Shapes.b2Shape,e_hitCollide,e_missCollide,e_startsInsideCollide,ComputeAABB,ComputeMass,ComputeSubmergedArea,Copy,GetType,RayCast,Set,TestOverlap,TestPoint" name="keywords">
<title>Box2D.Collision.Shapes.b2Shape</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'b2Shape - Box2DFlash Documentation';
				var baseRef = '../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">Box2DFlash Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../index-list.html')" href="../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../index.html?Box2D/Collision/Shapes/b2Shape.html&amp;Box2D/Collision/Shapes/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;b2Shape</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a>&nbsp;| <a href="#constantSummary">Constants</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class b2Shape"); titleBar_setSubNav(true,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">Box2D.Collision.Shapes</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class b2Shape</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Subclasses</td><td><a href="../Shapes/b2CircleShape.html">b2CircleShape</a>, <a href="../Shapes/b2PolygonShape.html">b2PolygonShape</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Source</td><td><a href="http://box2dflash.svn.sourceforge.net/viewvc/box2dflash/Source/Box2D/Collision/Shapes/b2Shape.as">b2Shape.as</a></td>
</tr>
</table>
<p></p>
A shape is used for collision detection. Shapes are created in b2Body.
You can use shape for collision detection before they are attached to the world.
<p>
<font color="red">Warning: </font>you cannot reuse shapes.
</p>
<p></p>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#ComputeAABB()">ComputeAABB</a>(aabb:<a href="../b2AABB.html">b2AABB</a>, xf:<a href="../../Common/Math/b2Transform.html">b2Transform</a>):void</div>
<div class="summaryTableDescription">
 Given a transform, compute the associated axis aligned bounding box for this shape.</div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#ComputeMass()">ComputeMass</a>(massData:<a href="b2MassData.html">b2MassData</a>, density:Number):void</div>
<div class="summaryTableDescription">
 Compute the mass properties of this shape using its dimensions and density.</div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#ComputeSubmergedArea()">ComputeSubmergedArea</a>(normal:<a href="../../Common/Math/b2Vec2.html">b2Vec2</a>, offset:Number, xf:<a href="../../Common/Math/b2Transform.html">b2Transform</a>, c:<a href="../../Common/Math/b2Vec2.html">b2Vec2</a>):Number</div>
<div class="summaryTableDescription">
  Compute the volume and centroid of this shape intersected with a half plane
  </div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#Copy()">Copy</a>():<a href="../Shapes/b2Shape.html">b2Shape</a>
</div>
<div class="summaryTableDescription">
  Clone the shape
  </div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#GetType()">GetType</a>():int</div>
<div class="summaryTableDescription">
 Get the type of this shape.</div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#RayCast()">RayCast</a>(output:<a href="../b2RayCastOutput.html">b2RayCastOutput</a>, input:<a href="../b2RayCastInput.html">b2RayCastInput</a>, transform:<a href="../../Common/Math/b2Transform.html">b2Transform</a>):Boolean</div>
<div class="summaryTableDescription">
  Cast a ray against this shape.</div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#Set()">Set</a>(other:<a href="b2Shape.html">b2Shape</a>):void</div>
<div class="summaryTableDescription">
  Assign the properties of anther shape to this
  </div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#TestOverlap()">TestOverlap</a>(shape1:<a href="b2Shape.html">b2Shape</a>, transform1:<a href="../../Common/Math/b2Transform.html">b2Transform</a>, shape2:<a href="b2Shape.html">b2Shape</a>, transform2:<a href="../../Common/Math/b2Transform.html">b2Transform</a>):Boolean</div>
<div class="summaryTableDescription">[static]</div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#TestPoint()">TestPoint</a>(xf:<a href="../../Common/Math/b2Transform.html">b2Transform</a>, p:<a href="../../Common/Math/b2Vec2.html">b2Vec2</a>):Boolean</div>
<div class="summaryTableDescription">
 Test a point for containment in this shape.</div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
</table>
</div>
<a name="constantSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Constants</div>
<table id="summaryTableConstant" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Constant</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#e_hitCollide">e_hitCollide</a> : int = 1<div class="summaryTableDescription">[static]
  Possible return values for TestSegment
  </div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#e_missCollide">e_missCollide</a> : int = 0<div class="summaryTableDescription">[static] Return value for TestSegment indicating a miss.</div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#e_startsInsideCollide">e_startsInsideCollide</a> : int = -1<div class="summaryTableDescription">[static] Return value for TestSegment indicating that the segment starting point, p1, is already inside the shape.</div>
</td><td class="summaryTableOwnerCol">b2Shape</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="ComputeAABB()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">ComputeAABB</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function ComputeAABB(aabb:<a href="../b2AABB.html">b2AABB</a>, xf:<a href="../../Common/Math/b2Transform.html">b2Transform</a>):void</code><p>
 Given a transform, compute the associated axis aligned bounding box for this shape.
 </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">aabb</span>:<a href="../b2AABB.html">b2AABB</a></code> &mdash; returns the axis aligned box.
 </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">xf</span>:<a href="../../Common/Math/b2Transform.html">b2Transform</a></code> &mdash; the world transform of the shape.
 </td>
</tr>
</table>
</div>
<a name="ComputeMass()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">ComputeMass</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function ComputeMass(massData:<a href="b2MassData.html">b2MassData</a>, density:Number):void</code><p>
 Compute the mass properties of this shape using its dimensions and density.
 The inertia tensor is computed about the local origin, not the centroid.
 </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">massData</span>:<a href="b2MassData.html">b2MassData</a></code> &mdash; returns the mass data for this shape.
 </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">density</span>:Number</code></td>
</tr>
</table>
</div>
<a name="ComputeSubmergedArea()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">ComputeSubmergedArea</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function ComputeSubmergedArea(normal:<a href="../../Common/Math/b2Vec2.html">b2Vec2</a>, offset:Number, xf:<a href="../../Common/Math/b2Transform.html">b2Transform</a>, c:<a href="../../Common/Math/b2Vec2.html">b2Vec2</a>):Number</code><p>
  Compute the volume and centroid of this shape intersected with a half plane
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">normal</span>:<a href="../../Common/Math/b2Vec2.html">b2Vec2</a></code> &mdash; the surface normal
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">offset</span>:Number</code> &mdash; the surface offset along normal
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">xf</span>:<a href="../../Common/Math/b2Transform.html">b2Transform</a></code> &mdash; the shape transform
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">c</span>:<a href="../../Common/Math/b2Vec2.html">b2Vec2</a></code> &mdash; returns the centroid
  </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Number</code> &mdash; the total volume less than offset along normal
  </td>
</tr>
</table>
</div>
<a name="Copy()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">Copy</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function Copy():<a href="../Shapes/b2Shape.html">b2Shape</a></code><p>
  Clone the shape
  </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../Shapes/b2Shape.html">b2Shape</a></code></td>
</tr>
</table>
</div>
<a name="GetType()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">GetType</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function GetType():int</code><p>
 Get the type of this shape. You can use this to down cast to the concrete shape.
 </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>int</code> &mdash; the shape type.
 </td>
</tr>
</table>
</div>
<a name="RayCast()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">RayCast</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function RayCast(output:<a href="../b2RayCastOutput.html">b2RayCastOutput</a>, input:<a href="../b2RayCastInput.html">b2RayCastInput</a>, transform:<a href="../../Common/Math/b2Transform.html">b2Transform</a>):Boolean</code><p>
  Cast a ray against this shape.
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">output</span>:<a href="../b2RayCastOutput.html">b2RayCastOutput</a></code> &mdash; the ray-cast results.
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">input</span>:<a href="../b2RayCastInput.html">b2RayCastInput</a></code> &mdash; the ray-cast input parameters.
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">transform</span>:<a href="../../Common/Math/b2Transform.html">b2Transform</a></code> &mdash; the transform to be applied to the shape.
  </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="Set()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">Set</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function Set(other:<a href="b2Shape.html">b2Shape</a>):void</code><p>
  Assign the properties of anther shape to this
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">other</span>:<a href="b2Shape.html">b2Shape</a></code></td>
</tr>
</table>
</div>
<a name="TestOverlap()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">TestOverlap</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function TestOverlap(shape1:<a href="b2Shape.html">b2Shape</a>, transform1:<a href="../../Common/Math/b2Transform.html">b2Transform</a>, shape2:<a href="b2Shape.html">b2Shape</a>, transform2:<a href="../../Common/Math/b2Transform.html">b2Transform</a>):Boolean</code><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">shape1</span>:<a href="b2Shape.html">b2Shape</a></code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">transform1</span>:<a href="../../Common/Math/b2Transform.html">b2Transform</a></code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">shape2</span>:<a href="b2Shape.html">b2Shape</a></code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">transform2</span>:<a href="../../Common/Math/b2Transform.html">b2Transform</a></code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="TestPoint()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">TestPoint</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function TestPoint(xf:<a href="../../Common/Math/b2Transform.html">b2Transform</a>, p:<a href="../../Common/Math/b2Vec2.html">b2Vec2</a>):Boolean</code><p>
 Test a point for containment in this shape. This only works for convex shapes.
 </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">xf</span>:<a href="../../Common/Math/b2Transform.html">b2Transform</a></code> &mdash; the shape world transform.
 </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p</span>:<a href="../../Common/Math/b2Vec2.html">b2Vec2</a></code> &mdash; a point in world coordinates.
 </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="constantDetail"></a>
<div class="detailSectionHeader">Constant detail</div>
<a name="e_hitCollide"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">e_hitCollide</td><td class="detailHeaderType">constant</td>
</tr>
</table>
<div class="detailBody">
<code>public static const e_hitCollide:int = 1</code><p>
  Possible return values for TestSegment
  </p></div>
<a name="e_missCollide"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">e_missCollide</td><td class="detailHeaderType">constant</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static const e_missCollide:int = 0</code><p> Return value for TestSegment indicating a miss. </p></div>
<a name="e_startsInsideCollide"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">e_startsInsideCollide</td><td class="detailHeaderType">constant</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static const e_startsInsideCollide:int = -1</code><p> Return value for TestSegment indicating that the segment starting point, p1, is already inside the shape. </p></div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright">Box2DFlash 2.1a</center>
</div>
</body>
</html>
<!--Box2DFlash 2.1a-->
